package com.cotte.flow.controller;

import java.text.ParseException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cotte.flow.service.BrushCardService;

@RestController
@RequestMapping("/hbase/test")
public class HbaeController {
	
	@Autowired
	private BrushCardService service;
	
	@GetMapping("/save")
	public void save() throws ParseException {
		Map<String,String> map = new HashMap<String,String>();
		/*map.put("odid", "11338327");
		map.put("stepCode", "100");
		map.put("empCode", "R102285");
		map.put("syscode", "USI811240003");
		map.put("orderCode", "TMW18115700");
		map.put("loadDate", "2018-11-27 11:40:50.040");*/
		map.put("odid", "11427861");
		map.put("stepCode", "3");
		map.put("empCode", "R64169");
		map.put("syscode", "USI812050047");
		map.put("orderCode", "TMW18120982");
		map.put("loadDate", "2018-12-05 15:07:17.000");
		service.saveBrushCard(map);
		String version = "v2";
		Map<String,Object> resultMap = service.updateOccupy(version,map.get("syscode"), 
				map.get("odid"), map.get("stepCode"));
		service.updateWorkHour(map.get("odid"), map.get("stepCode"), map.get("empCode"), map.get("loadDate"));
		service.saveTransitTime(map.get("odid"), map.get("stepCode"), map.get("loadDate"), resultMap);
	}
	
	@GetMapping("/update")
	public void update() {
		String syscode = "USI811240003";
		String odid = "11338327";
		String stepcode = "100";
		String version = "v2";
		service.updateOccupy(version,syscode, odid, stepcode);
	}
	
	@GetMapping("/workHour")
	public void updateWorkHour() {
		
	}
}
